package com.jiazhong.boot.mybatis.plus.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jiazhong.boot.commons.bean.plus.Dept;
import com.jiazhong.boot.commons.bean.plus.Emp;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EmpMapper extends BaseMapper<Emp> {

    @Select("select * from emp where state=1")
    @Results(value = {
            @Result(property = "empNo", column = "empNo", id = true),
            @Result(property = "ename", column = "ename"),
            @Result(property = "dept", javaType = Dept.class, column = "deptno",
                    one = @One(select = "com.jiazhong.boot.mybatis.plus.mapper.DeptMapper.findById"))
    })
    List<Emp> find();
}
